package com.rzj.sys_lab_assistant.service.impl;

import com.rzj.sys_lab_assistant.dao.RecruitmentPlanMapper;
import com.rzj.sys_lab_assistant.entity.RecruitmentPlan;
import com.rzj.sys_lab_assistant.entity.bo.RecruitmentPlanBO;
import com.rzj.sys_lab_assistant.entity.bo.RecruitmentPostBO;
import com.rzj.sys_lab_assistant.service.IRecruitmentPlanService;
import com.rzj.sys_lab_assistant.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: sys_lab_assistant
 * @description:
 * @author: 作者
 * @create: 2021-07-01 15:11
 */
@Service
public class RecruitmentPlanServiceImpl implements IRecruitmentPlanService {

    @Autowired
    RecruitmentPlanMapper recruitmentPlanMapper;

    TimeUtils timeUtils;

    @Override
    public List<RecruitmentPlanBO> recruitmentPlansList(String account) {
        return recruitmentPlanMapper.listRecruitmentPlans(account);
    }

    @Override
    public List<RecruitmentPlanBO> recruitmentPlanList() {
        return recruitmentPlanMapper.listRecruitmentPlan();
    }

    @Override
    public RecruitmentPlanBO getRecruitmentPlanById(int planId) {
        return recruitmentPlanMapper.getRecruitmentPlanById(planId);
    }

    @Override
    public RecruitmentPlanBO getRecruitmentPlanByName(String planName) {
        return recruitmentPlanMapper.getRecruitmentPlanByName(planName);
    }

    @Override
    public int addRecruitmentPlan(RecruitmentPlan recruitmentPlan) {
        recruitmentPlan.setStatus(0);
        recruitmentPlan.setApplyTime(timeUtils.getTime());
        recruitmentPlan.setCreateTime(timeUtils.getTime());
        recruitmentPlan.setModifyTime(timeUtils.getTime());
        return recruitmentPlanMapper.saveRecruitmentPlan(recruitmentPlan);
    }

    @Override
    public int updateRecruitmentPlan(RecruitmentPlan recruitmentPlan) {
        recruitmentPlan.setModifyTime(timeUtils.getTime());
        return recruitmentPlanMapper.updateRecruitmentPlan(recruitmentPlan);
    }

    @Override
    public int updateRecruitmentPlanStatus(RecruitmentPlan recruitmentPlan) {
        recruitmentPlan.setModifyTime(timeUtils.getTime());
        return recruitmentPlanMapper.updateRecruitmentPlanStatus(recruitmentPlan);
    }

    @Override
    public int updateRecruitmentPlanNum(RecruitmentPlan recruitmentPlan) {
        recruitmentPlan.setModifyTime(timeUtils.getTime());
        return recruitmentPlanMapper.updateRecruitmentPlanNum(recruitmentPlan);
    }

    @Override
    public int delRecruitmentPlan(int planId) {
        return recruitmentPlanMapper.deleteRecruitmentPlan(planId);
    }
}
